{template modoer_header}
{eval _G('loader')->helper('form');}
<div id="body">
	<div class="myhead"></div>
	<div class="mymiddle">
		<div class="myleft">
		<!--{eval !$mymenu && $mymenu = 'mmenu';}-->
		<!--{template $mymenu,'member','member'}-->
		</div>
		<div class="myright">
			<div class="myright_top"></div>
			<div class="myright_middle">
				<h3><cite>当前操作的主题:<span class="font_2">$_G[manage_subject][name]{if $_G[manage_subject][subname]}($_G[manage_subject][subname]){/if}</span>[<a href="javascript:void(0);" onclick="item_subject_manage();">更换</a>]</cite>自定义指令</h3>
				<div class="mainrail">
					{if $error}<div class="formerror">$error</div>{/if}
					<form method="post" name="cmd_save" action="{url weixin/member/ac/$ac/op/save/rand/$_G[random]}">
						<table width="100%" cellspacing="0" cellpadding="0" class="maintable">
							<tr>
								<td width="120" align="right" valign="top"><span class="font_1">*</span>关键字：</td>
								<td width="*">
									<input type="text" name="keyword" class="t_input" size="20" value="$post[keyword]" />
									<p class="font_3">即用户在微信内回复的文字，如果关键字匹配，则会触发本条指令进行回复。</p>
								</td>
							</tr>
							<tr>
								<td align="right" valign="top"><span class="font_1">*</span>指令名称：</td>
								<td>
									<input type="text" name="name" class="t_input" size="40" value="$post[name]" />
									<p class="font_3">指令的名称。</p>
								</td>
							</tr>
							<tr>
								<td align="right" valign="top"><span class="font_1">*</span>指令介绍：</td>
								<td>
									<input type="text" name="intro" class="t_input" size="60" value="$post[intro]" />
									<p class="font_3">描述下本条指令的作用。</p>
								</td>
							</tr>
							<tr>
								<td align="right" valign="top"><span class="font_1">*</span>回复类型：</td>
								<td>
									<input type="radio" name="msgtype" value="text" id="msgtype_text" {if $post['msgtype']=='text'}checked="check"{/if} /><label for="msgtype_text">文本</label>
									<input type="radio" name="msgtype" value="news" id="msgtype_news" {if $post['msgtype']=='news'}checked="check"{/if} /><label for="msgtype_news">图文</label>
									<p class="font_3">在公众平台高级功能页面，可以找到；微信公众平台账号如果没认证则没有AppID，也无法使用自定义菜单</p>
								</td>
							</tr>
							<tr>
								<td align="right" valign="top"><span class="font_1">*</span>回复内容：</td>
								<td>
									<div class="J_msgtype msgtype-text">
										<textarea name="content" style="height:120px;width:400px;display:block;margin-bottom:5px;">{if $post['msgtype']=='text'}$post[content]{/if}</textarea>
										<p class="font_3">微信文本可以识别URL连接（中文连接无法识别）</p>
									</div>
									<div class="J_msgtype msgtype-news none">
										<ul class="msgtype-news-group"></ul>
                                            <button type="button" id="add_news_btn" class="btn">新增一条</button>
										<p class="font_3">图文信息最多10条。第一条为大图，大图尺寸建议360*200，小图建议200*200。图文描述仅在只有1条图文信息时显示在微信中。</p>
									</div>
									<p class="font_3">当本条指令被触发时，此处填写的内容将自动回复给用户。</p>
								</td>
							</tr>
							<tr>
								<td align="right" valign="top"><span class="font_1">*</span>是否为默认回复：</td>
								<td>
									{print form_bool('is_default',$post['is_default'])}
									<p class="font_3">当用户发送的指令无法识别时，总是回复本条指令（需要在<a href="{url weixin/member/ac/g_mp}">公众号设置</a>里开启）。<br />当前设置为唯一性（设置当前指令后，其他指令将被自动取消）。</p>
								</td>
							</tr>
							<tr>
								<td align="right" valign="top"><span class="font_1">*</span>是否为关注回复：</td>
								<td>
									{print form_bool('is_subscribe',$post['is_subscribe'])}
									<p class="font_3">当用户在微信内关注当前公众平台帐号时，自动发送当前指令给关注者；<br />当前设置为唯一性。</p>
								</td>
							</tr>
							<tr>
								<td></td>
								<td>
									<input type="hidden" name="before_op" value="$op" />
									<!--{if $op=='edit'}-->
									<input type="hidden" name="id" value="$id" />
									<!--{/if}-->
									<input type="hidden" name="mp_id" value="$role_obj->id" />
									<button type="submit" name="dosubmit" value="yes">提交</button>&nbsp;&nbsp;
									<button type="button" name="return" onclick="jslocation('{url weixin/member/ac/$ac}')">返回</button>
									<span class="font_3">标记" * "号设置项为必填</span>
								</td>
							</tr>
						</table>
					</form>
					</form>
				</div>
			</div>
		</div>
		<div class="clear"></div>
	</div>
	<div class="mybottom"></div>
</div>
<form class="J_form none" method="post" enctype="multipart/form-data" action="{url modoer/upload/in_ajax/1}">
	<table width="100%" cellspacing="0" cellpadding="0" class="maintable">
		<tr>
			<td align="right" valign="top" width="60"><span class="font_1">*</span>标题：</td>
			<td width="*">
				<input type="text" name="Title" class="t_input" size="40" value="" />
			</td>
		</tr>
		<tr>
			<td align="right" valign="top">描述：</td>
			<td width="*">
				<input type="text" name="Description" class="t_input" size="60" value="" />
			</td>
		</tr>
		<tr>
			<td align="right" valign="top"><span class="font_1">*</span>连接：</td>
			<td width="*">
				<input type="text" name="Url" class="t_input" size="60" value="http://" />
				<select id="cmds" onchange="$(this).prev().val($(this).find(':selected').val());">
					<option value="">==快捷URL==</option>
					{print form_weixin_subject_links($role_obj)}
				</select>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top"><span class="font_1">*</span>图片：</td>
			<td width="*">
				<input type="file" name="picture" accept="image/*" />
				<input type="hidden" name="set_domain" value="N" />
			</td>
		</tr>
	</table>
	<center style="margin-top:10px;">
		<button type="submit" name="dosubmit" value="yes">提交</button>&nbsp;&nbsp;
		<button type="button" class="btn unimportant" data-type="close">关闭</button>
	</center>
</form>
<style>
	.msgtype-news-item {
	    position: relative;
	    display: block;
	    padding: 10px;
	    margin-bottom: -1px;
	    background-color: #fff;
	    border: 1px solid #ddd;
	}
	.msgtype-news-item:last-child {
		margin-bottom:10px;
	}
	.msgtype-news-item .fl {
	    float:left!important;
	}
	.msgtype-news-item .fr {
	    float:right!important;
	}
	.msgtype-news-item .richtxt,
	.msgtype-news-item .richtxt-body {
	    overflow: hidden;
	   	line-height:20px;
	}
	.msgtype-news-item .richtxt .fl {
	    margin-right: 10px;
	}
	.msgtype-news-item .richtxt .richtxt-img {
	    display: block;
	    border:1px solid #ddd;
	    margin:auto;
	    width:60px;
	    height:60px;
	}
	.msgtype-news-item:first-child .richtxt .richtxt-img {
	    width:108px;
	    height:60px;
	}
	.msgtype-news-item .richtxt-body > div > span {
		display: block;
		color: #888;
	}
	.msgtype-news-item .richtxt-body > div > span.Title {
		font-weight: bold;
	}
	.msgtype-news-item .richtxt-body > .opt {

	}
	.msgtype-news-item .richtxt-body > .opt > a.blk {
		display: block;
	}
</style>
<script type="text/javascript" src="{URLROOT}/static/javascript/item.js"></script>
<script type="text/javascript" src="{URLROOT}/static/javascript/weixin.form.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		var news_list = new Array();
		<!--{if $post['msgtype']=='news' && is_array($post['content']) && $post['content']}-->
		<!--{loop $post['content'] $key $params}-->
		news_list.push({
				Title:'$params[Title]',
				Description:'$params[Description]',
				Url:'$params[Url]',
				PicUrl:'$params[PicUrl]'
		});
		<!--{/loop}-->
		<!--{/if}-->

		var cmd = new weixin.custom_cmd();
		$.each(news_list, function(index, val) {
			cmd.add_item(val);
		});

		if($('.formerror')[0]) {
			setTimeout(function() {
				$('.formerror').fadeOut();
			}, 2000);
		}
	});
</script>
<!--{eval footer();}-->